package com.djf.Scrm.dataRelay.schedule;

import com.djf.Scrm.dataRelay.service.ReceiveCustInfoService;
import com.djf.Scrm.dataRelay.utils.ServiceException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class AcceptShedule {

    @Autowired
    private ReceiveCustInfoService custInfoService;
    /**
     * 获取客户信息
     * @throws ServiceException
     */
    @Scheduled(fixedDelay = 8000)
    public void receiveCustInfo() throws ServiceException {
        try {
            custInfoService.viewCustInfo();
            log.info("接收客户信息");
            System.out.println("接收客户信息");
        }catch (Exception ex) {
            log.error("Task error:"+ex.getMessage(), ex);
        }
    }

    /**
     * 获取供应商信息
     * @throws ServiceException
     */
    @Scheduled(fixedDelay = 8000)
    public void receivesupplier() throws ServiceException {
        try {
            log.info("接收供应商信息");
            System.out.println("接收供应商信息");
        }catch (Exception ex) {
            log.error("Task error:"+ex.getMessage(), ex);
        }
    }
}
